<template>
	<div>
		<HomeHeader></HomeHeader>
		<HomeLeft :cur="3"></HomeLeft>
		<div id="main">
			<div id="web_con" v-if="isedit">
				<div class="web_wp">
					<div class="web_location">
						<div class="here_area">
							<strong>当前位置：</strong>财富管理&nbsp;&nbsp;»&nbsp;&nbsp;确认
						</div>
						<div class="here_btn">
							<a href="javascript:history.back()" class="web_btn btn_add"><em
									class="iconfont icon-shdcfanhui"></em>返回</a>
						</div>
					</div>

					<div class="tabTitle">
						<ul class="clearfix">
							<li class="cur"><a href="javascript:;">基本信息</a></li>
						</ul>
						<div class="tabCont">
							<div class="cont">
								<table class="dataTable">

									<tr>
										<td class="ltd">支付凭证</td>
										<td class="rtd">
											<img style="width: 200px;" :src="info.credentials" alt="">
										</td>
									</tr>
									<!-- <tr>
										<td class="ltd">凭证上传时间</td>
										<td class="rtd">
											<input type="text" class="input-text">
										</td>
									</tr> -->
								</table>
							</div>
						</div>
						<div>
							<div class="contBtn">
								<table class="dataTable">
									<tfoot>
										<tr>
											<td class="ltd"></td>
											<td class="rtd">
												<a href="javascript:;" class="web_btn btn_add" @click="SubMit('pass')">
													<em class="iconfont icon-shdcbaocun"></em>通过
												</a>

												<a href="javascript:;" class="web_btn btn_add"
													@click="SubMit('refuse')">
													<em class="iconfont icon-shdcsub-add-copy"></em>不通过
												</a>
											</td>
										</tr>
									</tfoot>
								</table>
							</div>
						</div>
					</div>
				</div>

			</div>
		</div>
	</div>
</template>

<script>
	import HomeHeader from '../components/Header.vue';
	import HomeLeft from '../components/Left.vue';
	import PicUp from '../components/PicUp.vue'
	export default {
		components: {
			HomeHeader,
			HomeLeft,
			PicUp
		},
		data() {
			return {
				info: [],
				isedit: false,
			}
		},
		onLoad(e) {
			let that = this;
			that.GetDeta(e.id);
		},
		methods: {
			// 详情
			GetDeta: function(id) {
				let that = this;
				uni.showLoading({
					title: '加载中...',
					mask: true
				});
				that.common.http('GET', 'pay/' + id, '', function(res) {
					uni.hideLoading();
					console.log(res.data)
					that.info = res.data;

					that.isedit = true;
				});
			},

			//保存
			SubMit: function(txt) {
				let that = this;
				that.$confirm(txt=='pass'?'确定要通过吗？':'确定不通过吗？', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					that.common.http('POST', 'pay/' + that.info.id + '/' + txt, '', function(res) {
						uni.hideLoading();
						uni.showToast({
							icon: 'none',
							title: '操作成功',
							duration: 2000
						});
						setTimeout(function() {
							that.navigateBack();
						}, 1500);
					});
				}).catch(() => {

				});
			},

			navigateBack() {
				// #ifdef H5
				const pages = getCurrentPages()
				if (pages.length > 1) {
					uni.navigateBack(1)
					return;
				}
				//使用vue-router返回上一级
				let a = this.$router.go(-1)
				if (a == undefined) {}
				return;
				// #endif
				uni.navigateBack();
			},

		}
	}
</script>

<style>


</style>